///////////////////////////////////////////////////////////////////////////
//
// Spring Engine Source File.
// Copyright (C), Dengtao 2011-2021
// ----------------------------------------------------------------------
// File name:   SfBaseDefines.h
// Version:     v1.0.0
// Created:     2013/06/13 22:54 by dengtao
// Compilers:   Visual Studio 2008
// Description: 
// ----------------------------------------------------------------------
// History:
//
///////////////////////////////////////////////////////////////////////////

#ifndef _SfBaseDefines_H_
#define _SfBaseDefines_H_

#include <assert.h>

//
//new,delete
#ifdef SF_USE_MEMORY_TRACK
#define SfNew		new(__FILE__, __LINE__, __FUNCTION__)
#define SfDelete	delete
#else
#define SfNew		new
#define SfDelete	delete
#endif

//
//define some constants
#define SfNull	0
#define SfIsValidPtr(ptr)	(SfNull != ptr)
#define SfIsNullPtr(ptr)	(SfNull == ptr)

//
// debug
#define SfAssert(exp)		assert(exp)
#define SfAssertValidPtr(p)	SfAssert(SfNull != p)
#define SfAssertNullPtr(p)	SfAssert(SfNull == p)

//
//utils macros defines
#define SfUnreferencedParam(p)	(p)
#define SfSafeDelete(p)			if (p) { delete p; }
#define SfSafeDeleteArray(p)	if (p) { delete[] p; }
#define SfSafeRelease(p)		if (p) { p->Release(); }

#endif
